#include "stc15f2k60s2.h"
#include "Seg.h"
#include "Tim.h"
#include "Ultrasonic.h"
#include "stdio.h"
unsigned char pucSeg_Buf[9],pucSeg_Code[8],ucSeg_Pos;
unsigned int ucSeg_Dly;
unsigned long ulms;
unsigned char ucWave;
void Seg_Proc(void);
void main(){
	Cls_Peripheral() ;
	Timer1Init();
	Timer0Init();
	while(1){
		Seg_Proc();
}
}
void Time_1(void) interrupt 3 //定时器1中断函数
{ 
	 ulms++; 
	 if(!(ulms % 1000)) 
	 { 
		 
	} 
	 if(++ucSeg_Dly==500) ucSeg_Dly=0;
	 Seg_Disp(pucSeg_Code, ucSeg_Pos);
	if(++ucSeg_Pos==8) ucSeg_Pos=0;
}
void Seg_Proc(void){
	if(ucSeg_Dly) return;
	ucSeg_Dly=1;
	ucWave=Wave_Recv();
	sprintf(pucSeg_Buf,"%04d",(unsigned int)ucWave);
	Seg_Tran(pucSeg_Buf, pucSeg_Code);
}